package com.dazhewan.project.properties;

import com.dazhewan.utils.FunctionUtil;
import com.dazhewan.utils.ScreenUtil;

import java.awt.*;
import java.awt.image.BufferedImage;

/**
 * @author: zheng
 * @code date: 2022/10/11
 * @code className: CutScreenInto
 * @code description: 截图相关的类
 */
public class CutScreenInfo {
    /**
     * 记录全屏的截图
     */
    private BufferedImage windowImage;
    private int operateCode;
    /**
     * 记录截屏的图片
     */
    private BufferedImage image;
    /**
     * 记录识别的文本
     */
    private String textContent;

    public BufferedImage getImage() {
        return image;
    }

    public int getOperateCode() {
        return operateCode;
    }

    public void setOperateCode(int operateCode) {
        this.operateCode = operateCode;
    }

    public void setImage(int x1, int y1, int x2, int y2) {
        final int minx = Math.min(x1, x2);
        final int miny = Math.min(y1, y2);
        final int width = Math.abs(x1 - x2);
        final int height = Math.abs(y1 - y2);
        image = ScreenUtil.screenShot(minx, miny, width, height);
    }

    public String getTextContent() {
        return textContent;
    }

    public void setTextContent(String textContent) {
        this.textContent = textContent;
    }

    public BufferedImage getWindowImage() {
        return windowImage;
    }

    public void setWindowImage(BufferedImage windowImage) {
        this.windowImage = windowImage;
    }
}
